package org.vacoor.ticket.bean;

import org.vacoor.ticket.exception.NotFindStationException;
import org.vacoor.ticket.util.StationUtil;

public class Station {
	private String name;
	private String code;
	
	public static Station getInstance(String name) throws NotFindStationException {
		String code = StationUtil.getStationCodeByName(name);
		if(code == null || "".equals(null)) {
			throw new NotFindStationException("station:" + name + " is not find!");
		}
		return new Station(name,code);
	}
	
	private Station(String name,String code) {
		this.name = name;
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Override
	public String toString() {
		return "Station [name=" + name + ", code=" + code + "]";
	}
}
